package cn.com.dashihui.web.controller;

import com.jfinal.kit.JsonKit;
import com.jfinal.kit.StrKit;

import cn.com.dashihui.web.base.BaseController;
import cn.com.dashihui.web.service.APIService;

public class APIController extends BaseController{
	private static APIService service = new APIService();
	
	public void province(){
		renderText(JsonKit.toJson(service.getAllProvince()));
	}
	
	public void city(){
		int parentid = getParaToInt(0);
		renderText(JsonKit.toJson(service.getAllCityByProvince(parentid)));
	}
	
	public void area(){
		int parentid = getParaToInt(0);
		renderText(JsonKit.toJson(service.getAllAreaByCity(parentid)));
	}
	
	public void category(){
		String parentidStr = getPara(0);
		int parentid = StrKit.isBlank(parentidStr)?0:Integer.valueOf(parentidStr);
		renderText(JsonKit.toJson(service.getCategoryByParent(parentid)));
	}
	public void categorys(){
		String parentidStr = getPara(0);
		int parentid = StrKit.isBlank(parentidStr)?1:Integer.valueOf(parentidStr);
		renderText(JsonKit.toJson(service.getCategoryByParent(parentid)));
	}
	public void storeAll(){
		renderText(JsonKit.toJson(service.getStoreAll()));
	}
	public void sellerAll(){
		renderText(JsonKit.toJson(service.getSellerAll()));
	}
	public void sellerAllState(){
		renderText(JsonKit.toJson(service.getSellerAllState()));
	}
	public void storeState(){
		String parentidStr = getPara(0);
		renderText(JsonKit.toJson(service.getStoreState(parentidStr)));
	}
	public void store(){
		String parentidStr = getPara(0);
		renderText(JsonKit.toJson(service.getStore(parentidStr)));
	}
	public void stores(){
		String parentidStr = getPara(0);
		int goodsid = getParaToInt(1);
		renderText(JsonKit.toJson(service.getStores(parentidStr,goodsid)));
	}
	public void logistics(){
		renderText(JsonKit.toJson(service.getLogistics()));
	}
	public void tag(){
		renderText(JsonKit.toJson(service.getTag()));
	}
}
